from itertools import groupby
class Solution(object):
    def description(self, name):
        res = ""
        for k, g in groupby(name):
            res += str(len(list(g))) + k
        return res

    def countAndSay(self, n):
        """
        :type n: int
        :rtype: str
        """
        s = '1'
        for i in range(n-1):
            s = self.description(s)
        return s


if __name__ == "__main__":
    s = Solution()
    print(s.countAndSay(1))
    print(s.countAndSay(2))
    print(s.countAndSay(3))
    print(s.countAndSay(4))
    print(s.countAndSay(5))